package v1

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"server/internal/model"
	"server/pkg/app"
)

func CreateHisCase(c *gin.Context) {
	hiscase := &model.HisCase{}
	_ = c.ShouldBind(hiscase)
	if err := hiscase.Create(); err != nil {
		c.String(http.StatusOK, err.Error())
		return
	}
	c.String(http.StatusOK, "用例创建成功")
}

func HisCaseList(c *gin.Context) {
	pages := &app.Page{}
	pages.Info(c)
	hiscase := &model.HisCase{}
	hiscase_list, total := hiscase.List(pages)
	c.JSON(http.StatusOK, gin.H{
		"total": total,
		"data":  hiscase_list,
	})
}
